Skip to content

fix(api): move focus manifest refresh off GET - #523

Merged
JSONbored merged 2 commits into
mainfrom
codex/propose-fix-for-csrf-vulnerability
Jun 11, 2026
Merged

fix(api): move focus manifest refresh off GET#523
JSONbored merged 2 commits into
mainfrom
codex/propose-fix-for-csrf-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The GET /v1/repos/:owner/:repo/focus-manifest route previously accepted refresh=true and performed a persisted refresh, which made a state-changing operation reachable from a safe GET and therefore CSRF-vulnerable given browser SameSite=Lax session cookies.
  • The intent is to preserve the ability for authorized maintainers/operators to refresh a repo's focus manifest while preventing cross-site GETs from mutating persisted manifest state.

Description

  • Stop honoring the refresh=true query parameter in the GET /v1/repos/:owner/:repo/focus-manifest handler so GET now only returns the cached or computed manifest via loadRepoFocusManifest(c.env, fullName).
  • Add an unsafe POST /v1/repos/:owner/:repo/focus-manifest/refresh endpoint that performs an explicit cache refresh by calling loadRepoFocusManifest(..., { refresh: true }) and reuses the same role and repo-access checks.
  • Update the OpenAPI spec and regenerate the UI OpenAPI JSON to document the new POST refresh path.
  • Update unit tests in test/unit/routes-focus-manifest.test.ts to assert that GET ?refresh=true no longer refreshes the persisted cache and that the new POST .../refresh endpoint does perform refreshes.

Testing

  • Ran the focused unit tests with npx vitest run test/unit/routes-focus-manifest.test.ts test/unit/focus-manifest-loader.test.ts, and all tests passed.
  • Ran static type checks with npm run typecheck, which completed successfully.

Codex Task

@ghost

ghost commented Jun 10, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #523 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 10, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 7c95d0a Commit Preview URL

Branch Preview URL
Jun 11 2026, 02:43 AM

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jun 10, 2026
@dosubot dosubot Bot added the size:S label Jun 11, 2026
@ghost

ghost commented Jun 11, 2026

Copy link
Copy Markdown

reviewbot · verdict: comment

The change moves the focus manifest refresh endpoint from a GET request to a POST request, which is a more suitable HTTP method for operations that modify server-side state.

Worth verifying in the preview

  • Verify that the API client is updated to send a POST request instead of a GET request
  • Check for any potential regressions in API behavior
  • Test the endpoint with different security schemes (GittensoryBearer and GittensorySessionCookie)

Before = production · After = this PR's preview deploy.

Route Before After
/ before

@JSONbored
JSONbored merged commit aeded45 into main Jun 11, 2026
12 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-csrf-vulnerability branch June 11, 2026 02:44
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 11, 2026
JSONbored added a commit that referenced this pull request Jun 12, 2026
isRepoFocusManifestPath was anchored at /focus-manifest, so the POST /focus-manifest/refresh route added in #523 was not covered by canSessionAccessPath -- a session-authenticated owner/maintainer was 403'd by the blanket guard before reaching the handler that would have allowed them. Match the optional /refresh sub-path so the route handler's own requireAppRole + requireSessionRepoAccess gate it.

Co-authored-by: galuis116 <galuis116@users.noreply.github.com>
Co-authored-by: ghost <49853598+JSONbored@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant